package com.shwread.android.qysw.activity.psychological;

import android.content.Intent;
import android.graphics.Color;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.ciko.code.base.BaseActicity;
import com.shwread.android.qysw10000243.R;

/**
 * 评测结论
 * Created by sss on 2017/10/11.
 */
public class EvaluatingConclusionActivity extends BaseActicity {

    private TextView tvEvaluatingConclusionTitle;
    private TextView tvEvaluatingConclusionScore;
    private TextView tvEvaluatingConclusionContent;
    private Button btReadMore;

    @Override
    protected void initTopBar() {
        enableNavLeftImg();
        setTitle("心理评测");
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_evaluating_conclusion);
    }

    @Override
    protected void initView() {
        tvEvaluatingConclusionTitle = findViewByID(R.id.tv_evaluating_conclusion_title);
        tvEvaluatingConclusionScore = findViewByID(R.id.tv_evaluating_conclusion_score);
        tvEvaluatingConclusionContent = findViewByID(R.id.tv_evaluating_conclusion_content);
        btReadMore = findViewByID(R.id.bt_read_more);
    }

    @Override
    protected void initAdapter() {

    }

    @Override
    protected void initDates() {
        Intent intent = getIntent();
        String result = intent.getStringExtra("result");
        String title = intent.getStringExtra("title");
        int source = intent.getIntExtra("source", 0);

        tvEvaluatingConclusionTitle.setText(title);
        tvEvaluatingConclusionScore.setText(String.valueOf(source));

        SpannableStringBuilder span = new SpannableStringBuilder("缩进" + result);
        span.setSpan(new ForegroundColorSpan(Color.TRANSPARENT), 0, 2, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
        tvEvaluatingConclusionContent.setText(span);
    }

    @Override
    protected void initListener() {
        btReadMore.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.bt_read_more://查看更多评测
                Intent intent = new Intent(this, EvaluatingChargeListActivity.class);
                startActivity(intent);
                finish();
                break;
        }
    }
}
